<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" session="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>

<ol class="breadcrumb">
	<li><spring:message code="tratamento.breadcrumb.n1" /></li>
	<li><a href="paciente_lista"><spring:message
				code="tratamento.breadcrumb.n2" /></a></li>
	<li><a href="paciente_editar?id=${paciente.id}"><spring:message
				code="tratamento.breadcrumb.n3" /></a></li>
	<c:choose>
		<c:when test="${empty atendimento.id}">
			<li class="active"><spring:message
					code="atendimento.form.label.new" /></li>
		</c:when>
		<c:otherwise>
			<li><a href="atendimento_editar?id=${atendimento.id}"> <spring:message
						code="tratamento.breadcrumb.n4" /></a></li>
			<c:choose>
				<c:when test="${empty tratamento.id}">
					<li class="active"><spring:message
							code="tratamento.form.label.new" /></li>
				</c:when>
				<c:otherwise>
					<li class="active"><spring:message
							code="tratamento.form.label.edit" /></li>
				</c:otherwise>
			</c:choose>
		</c:otherwise>
	</c:choose>
</ol>

<div class="row">
	<div class="col-md-2">
		<label for="tb008_id_atendimento"><spring:message
				code="atendimento.form.label.id" /></label> <input type="text"
			id="tb008_id_atendimento" class="form-control" readonly="readonly"
			value="${atendimento.id}" />
	</div>
	<div class="col-md-4">
		<label for="tb008_no_paciente"><spring:message
				code="atendimento.form.label.nomepaciente" /></label> <input type="text"
			id="tb008_no_paciente" class="form-control" disabled="disabled"
			value="${paciente.nome}" />
	</div>
	<div class="col-md-2">
		<label for="tb008_dt_inicio"><spring:message
				code="atendimento.form.label.datainicio" /></label>
		<form:input id="tb008_dt_inicio" path="atendimento.dataInicio"
			cssClass="form-control" disabled="true" />
	</div>
	<div class="col-md-2">
		<label for="tb008_dt_fim"><spring:message
				code="atendimento.form.label.datafim" /></label>
		<form:input id="tb008_dt_inicio" path="atendimento.dataFim"
			cssClass="form-control" disabled="true" />
	</div>
	<div class="col-md-2">
		<label for="tb008_ic_situacao"><spring:message
				code="atendimento.form.label.situacao" /></label> <input type="text"
			id="tb008_ic_situacao" class="form-control" disabled="disabled"
			value="${atendimento.situacaoAtendimento.descricao}">
	</div>
</div>

<div class="row">
	<div class="col-md-9">
		<h2>
			<c:choose>
				<c:when test="${empty atendimento.id}">
					<spring:message code="tratamento.form.label.new" />
				</c:when>
				<c:otherwise>
					<spring:message code="tratamento.form.label.edit" />
				</c:otherwise>
			</c:choose>
		</h2>
	</div>
	<div class="col-md-3">
		<c:if test="${empty atendimento.id}">
			<h2>
				P1 - P2 - P3 - <span style="text-decoration: underline;">P4</span>
			</h2>
		</c:if>
	</div>
</div>

<hr>

<form:form modelAttribute="tratamento" action="tratamento_salvar"
	method="post">
	<c:if test="${not empty tratamento.id}" var="tratamentoExistente" />
	<form:hidden id="tb009_id_tipo_tratamento" path="id" />
	<div class="form-group">
		<div class="row">
			<div class="col-md-12">
				<label for="tb009_ic_tipo_tratamento" class="obrigatorio">Tipo
					de Tratamento</label>

				<c:if test="${tratamentoExistente}">
					<form:hidden path="idTipoTratamento" />
				</c:if>
				<form:select id="tb009_ic_tipo_tratamento"
					cssClass="form-control marginBottom" path="idTipoTratamento"
					disabled="${tratamentoExistente}">
					<form:option value="0" label="Selecione" />
					<c:forEach items="${tiposTratamento}" var="tt">
						<form:option value="${tt.id}" cssClass="${tt.formatoTratamento}"
							label="${tt.nome}" />
					</c:forEach>
				</form:select>
			</div>
		</div>

		<div id="divPasse">
			<div class="row">
				<c:if test="${empty tratamento.id}">
					<div class="col-md-6">
						<div class="input-group">
							<span class="input-group-addon"> <input type="radio"
								id="rdo_quantidade" name="tipo_passe" value="quantidade" /><label
								for="rdo_quantidade">Quantidade</label>
							</span> <span class="input-group-addon"> <input type="radio"
								id="rdo_data" name="tipo_passe" value="data" /><label
								for="rdo_data">Data</label>
							</span>
						</div>
						<!-- /input-group -->
					</div>
				</c:if>
			</div>

			<div class="row">
				<c:if test="${not empty tratamento.id}">
					<input type="hidden" id="hdn_tratamento_edicao" value="true" />
				</c:if>
				<c:if test="${empty tratamento.id}">
					<div class="col-md-2">
						<label for="tb009_qt_passe" class="obrigatorio">Quantidade
							de Passes:</label> <input type="text" id="tb009_qt_passe"
							class="form-control ng-pristine ng-invalid ng-invalid-required marginBottom"
							name="qtdePasses" />
					</div>
				</c:if>
				<div class="col-md-4">
					<label for="tb009_dt_passe" class="obrigatorio">Data do
						Passe:</label>
					<form:input id="tb009_dt_passe"
						cssClass="form-control ng-pristine ng-invalid ng-invalid-required marginBottom"
						path="dataPasse" />
				</div>
				<div class="col-md-2">
					<label for="tb009_ic_realizado">Realizado:</label>
					<form:select id="tb009_ic_realizado"
						cssClass="form-control marginBottom" path="realizado">
						<form:option value="false">
							<spring:message code="general.options.no" />
						</form:option>
						<form:option value="true">
							<spring:message code="general.options.yes" />
						</form:option>
					</form:select>
				</div>
				<div class="col-md-2">
					<label for="tb009_ic_remarcado">Remarcado:</label>
					<form:select id="tb009_ic_remarcado"
						cssClass="form-control marginBottom" path="remarcado">
						<form:option value="false">
							<spring:message code="general.options.no" />
						</form:option>
						<form:option value="true">
							<spring:message code="general.options.yes" />
						</form:option>
					</form:select>
				</div>
			</div>
		</div>

		<div id="divLeitura" class="row}">
			<div class="col-md-8">
				<label for="tb005_no_titulo" class="obrigatorio">Titulo do
					Livro</label>
				<form:select id="tb005_no_titulo"
					cssClass="form-control marginBottom" path="idLivro">
					<form:option value="0" label="Selecione" />
					<c:forEach items="${livros}" var="livro">
						<form:option value="${livro.id}" title="${livro.titulo}"
							label="${livro.titulo}" autor="${livro.autor}" />
					</c:forEach>
				</form:select>
			</div>
			<div class="col-md-4">
				<label for="tb005_no_autor" class="obrigatorio">Autor</label> <input
					type="text" id="tb005_no_autor" class="form-control marginBottom"
					disabled="disabled" />
			</div>
		</div>

		<div id="divCompromisso" class="row compromisso}">
			<div class="col-md-12">
				<label for="tb004_no_compromisso" class="obrigatorio">Compromisso</label>
				<form:select id="tb004_no_compromisso"
					cssClass="form-control marginBottom" path="idCompromisso">
					<form:option value="0" label="Selecione" />
					<c:forEach items="${compromissos}" var="compromisso">
						<form:option value="${compromisso.id}" title="${compromisso.nome}"
							label="${compromisso.nome}" />
					</c:forEach>
				</form:select>
			</div>
		</div>


		<div class="row">
			<div class="col-md-12">
				<c:choose>
					<c:when test="${empty atendimento.id}">
						<button type="submit" class="btn btn-default btn-primary">Salvar</button>
					</c:when>
					<c:otherwise>
						<c:if test="${atendimento.situacaoAtendimento == 'A'}">
							<button type="submit" class="btn btn-default btn-primary">Salvar</button>
						</c:if>
						<button id="btn_tratamento_cadastro_voltar" type="button"
							class="btn btn-default">Voltar</button>
					</c:otherwise>
				</c:choose>
			</div>
		</div>
	</div>
</form:form>